<?php

namespace App\Admin\SettingForms;

use Dcat\Admin\Widgets\Form;

class SiteSettingForm extends Form
{


    /**
     * Handle the form request.
     *
     * @param array $input
     *
     * @return mixed
     */
    public function handle(array $input)
    {
        admin_setting($input);
        return $this
            ->response()
            ->success('保存配置成功');
    }

    /**
     * Build a form here.
     */
    public function form()
    {
        $this->selfTimeRange("OPEN_START_TIME", 'OPEN_END_TIME', '营业时间')
            ->default([
                'start' => "09:00",
                'end' => "20:00",
            ]);
        $this->divider("小程序显示");
        $this->number("NOTIFY_BOX_TIME","须知显示时长(秒)")->default(5);
        $this->switch("SHOW_PROJECT_TIME","显示项目时间");
        $this->number("SHOW_DAY_COUNT","可预约日期天数")->default(7)->min(1);
        $this->number("DEPARTMENT_ROWS","科室一行显示个数")->default(4);
        $this->image("DEFAULT_DEPARTMENT_ICON", '默认科室图标')->autoUpload()->removable(false);

    }

    /**
     * The data of the form.
     *
     * @return array
     */
    public function default()
    {
        return admin_setting()->toArray();
    }
}
